package com.zhisland.base.support;

import com.zhisland.base.support.sys.interceptor.UserTestInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 作者: guo yao
 * 日期: 2016年11月21日
 * 时间: 下午18:04
 */
@Configuration
public class WebConfig extends WebMvcConfigurationSupport {


    // 配置静态文件
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    }

    // 配置拦截器
    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserTestInterceptor()).addPathPatterns("/test*//**");
    }
}
